<template>
    <div>
        <mt-swipe :auto="4000">
            <mt-swipe-item v-for="list in lunBotuList" :key="list.url">
                <img :src="list.img" alt="">
            </mt-swipe-item>
        </mt-swipe>

        <!-- 六宫格 -->
         <ul class="mui-table-view mui-grid-view mui-grid-9">
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><router-link to="/home/newslist">
                    <img src="../../images/menu1.png" alt="">
                    <div class="mui-media-body">新闻资讯</div></router-link></li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><router-link to="/home/newslist">
                    <img src="../../images/menu2.png" alt="">
                    <div class="mui-media-body">图片分享</div></router-link></li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><router-link to="/home/newslist">
                    <img src="../../images/menu3.png" alt="">
                    <div class="mui-media-body">商品购买</div></router-link></li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><router-link to="/home/newslist">
                    <img src="../../images/menu4.png" alt="">
                    <div class="mui-media-body">留言反馈</div></router-link></li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><router-link to="/home/newslist">
                    <img src="../../images/menu5.png" alt="">
                    <div class="mui-media-body">视频专区</div></router-link></li>
            <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><router-link to="">
                    <img src="../../images/menu6.png" alt="">
                    <div class="mui-media-body">联系我们</div></router-link></li>
        </ul> 
    </div>
</template>


<script>

var lunBoTuArr = [
    { img:'../../images/李溪芮1.jpg',url:"1" },
    { img:'../../images/李溪芮2.jpg',url:"2" },
    { img:'../../images/李溪芮3.jpg',url:"3" },
    { img:'../../images/李溪芮6.jpg',url:"6" },
    { img:'../../images/李溪芮8.jpg',url:"8" },
    { img:'../../images/李溪芮9.jpg',url:"9" },
    { img:'../../images/李溪芮10.jpg',url:"10" }
]

//引入Toast弹框
import { Toast } from "mint-ui"

export default {
    data(){
        return {
            lunBotuList:[],//轮播图图片数组
        }
    },
    created(){
        this.getLunBoTu();
    },
    methods: {
        getLunBoTu(){//获取轮播图的方法
            // this.$http.get('http://vue.studyit.io/api/getlunbo').then(result => {
            //     console.log(result.body.status === 0);
            //     if(result.body.status === 0){//成功
            //         this.lunBotuList = lunBoTuArr;
            //         Toast("加载成功");
            //     }else{//失败
            //         Toast("加载失败");
            //     }
            // })

            var status = 0;
            if(status === 0){//成功
                this.lunBotuList = lunBoTuArr;
                Toast({
                    message: "轮播图加载成功",
                    position: 'bottom',
                    duration: 800
                });
            }else{//失败
                Toast({
                    message: "轮播图加载失败",
                    position: 'bottom',
                    duration: 800
                });
            }
        }
    }
}
</script>


<style lang="less" scoped>
    .mint-swipe {
        height:200px;

        .mint-swipe-item {
            &:nth-child(odd) {
                background-color: red;
            }
            &:nth-child(even) {
                background-color:yellow;
            }

            img {
                height:100%;
                width:100%;
            }
        }
    }
    .mui-grid-view.mui-grid-9 {
        background-color: #fff;

        .mui-table-view-cell {
            border:none;

            img {
                height:60px;
            }

            .mui-media-body {
                font-size: 13px;
            }
        }
    }
</style>

